package com.ayitubie.refuelweb.config.quartz;
import com.ayitubie.refuelweb.controller.GasStationCtl;
import com.ayitubie.refuelweb.service.RefuelLogServ;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

@Slf4j
public class OilPriceQuartz extends QuartzJobBean {

    @Autowired
    private RefuelLogServ refuelLogServ;

    @Autowired
    private GasStationCtl gasStationCtl;

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info("启动定时任务！！！");
        try {
            refuelLogServ.getOilPrice(true);
            refuelLogServ.getWeather(true);
            //gasStationCtl.getAllLimitFromBjgov();
            gasStationCtl.getAllLimitFromBaidu();
        } catch (Exception e) {
            e.printStackTrace();
        }
        log.info("定时任务结束！！！");
    }
}
